import fetch from '../utils/Fetch';

/**
 * 获取一个时间段内(从from到to)的指定K线数据，返回的数据以ts排倒序.
 * @param {基础货币，如bitcoin，就是btc，注意是小写} baseCurrency 
 * @param {时间戳，秒为单位，指定时间段的终止时间} to 
 * @param {时间戳，秒为单位，指定时间段的开始时间} from 
 */
export const klineApi = (params) => fetch({
  url: 'kline',
  method: 'get',
  params,
});

/**
 * 获取交易对，用作调用k线api的参数
 * @param {交易所名称} exchangeName 
 * @param {币种标识符} baseCurrency 
 */
export const symbolsApi = (exchangeName, baseCurrency) => fetch({
  url: 'symbols',
  method: 'get',
  params: {
    exchangeName,
    baseCurrency
  },
});

/**
 * 获取交易市场数据
 * @param {币种标识符} baseCurrency 
 */
export const tradeMarketApi = (baseCurrency) => fetch({
  url: 'tradeMarket',
  method: 'get',
  params: {
    baseCurrency
  },
});

// fundsFlow
/**
 * 获取资金流动信息
 * @param {货币表示} baseCurrency 
 * @param {开始时间} from 
 * @param {结束时间} to 
 * @param {是否需要获取最近5天大单交易净流入	} require5DayFundsFlow 
 */
export const fundsFlowApi = (baseCurrency, from, to, require5DayFundsFlow = true) => fetch({
  url: 'fundsFlow',
  method: 'get',
  params: {
    baseCurrency,
    from,
    to,
    require5DayFundsFlow
  },
});

// 充币的日期
/**
 * 查询充币日期
 * @param {*} uniqueName 
 */
export const chargeDateApi = (uniqueName) => fetch({
  url: 'digiccy/bigChargeDates',
  method: 'get',
  params: {
    uniqueName
  },
});


// digiccy/exchange/detail
/**
 * 交易所基础数据
 * @param {*} exchange 
 * @param {*} baseCurrency 
 * @param {*} quoteCurrency 
 */
export const exchangeDetailApi = (exchange,baseCurrency,quoteCurrency) => fetch({
  url: 'digiccy/exchange/detail',
  method: 'get',
  params:{
    exchange,baseCurrency,quoteCurrency
  },
});
// exchange/5dayFundsFlow

/**
 * 交易所5日大单净流入
 * @param {*} exchange 
 * @param {*} baseCurrency 
 * @param {*} quoteCurrency 
 */
export const detail5DayFundsApi = (baseCurrency) => fetch({
  url: 'get5DayFunFlow',
  method: 'get',
  params:{
    baseCurrency
  },
});
/**
 * 交易所5日大单净流入
 * @param {*} exchange 
 * @param {*} baseCurrency 
 * @param {*} quoteCurrency 
 */
export const exchange5DayFundsApi = (exchange,baseCurrency,quoteCurrency,) => fetch({
  url: 'exchange/5dayFundsFlow',
  method: 'get',
  params:{
    exchange,baseCurrency,quoteCurrency,
  },
});
// exchange/fundsFlow
/**
 * 交易所主力动态与大单净流入
 * @param {*} exchange 
 * @param {*} baseCurrency 
 * @param {*} quoteCurrency 
 * @param {*} from 
 * @param {*} to 
 */
export const exchangeFundsFlowApi = (exchange,baseCurrency,quoteCurrency,from,to) => fetch({
  url: 'exchange/fundsFlow',
  method: 'get',
  params:{
    exchange,baseCurrency,quoteCurrency,from,to
  },
});